<template>
  <div class="subject">
    <span>{{num1}}</span>
    <span>+</span>
    <span>{{num2}}</span>
    <span>=</span>
    <input type="number" v-model="sum" />
    <button @click='sendFn'>提交</button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            sum:''
        }
    },
    computed:{
        num1(){
            return parseInt(Math.random()*100)
        },
        num2(){
            return parseInt(Math.random()*100)
        },
    },
    props:['list'],
    methods:{
        sendFn(){
            if(this.sum!==''){
                this.list.num1=this.num1
                this.list.num1=this.num2
                this.list.status=this.sum==this.num1+this.num2?true:false
            }
        }
    }
};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>